package file.ft;

import file.iobase.FileRead;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @Author 史祥连
 * @Date 2023/9/6 15:14
 * @Version 1.0
 */
public class RollBack {

    static String baseFilePath = "C:\\Datas\\E9\\9.00.2204.06_2";
    static String bakFilePath = "C:\\Datas\\E9\\a\\N宁波方太厨具有限公司";

    public static void main(String[] args) throws Exception{
        cc();
        //co();
        /*List<String> list = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\方太分支合并\\合并进程\\roll\\方太还原");
        for (String s : list) {
            boolean b = s.contains(".");
            if (b) {
                String sourceFile = baseFilePath+ s;
                String targetFile = bakFilePath+s;
                File file = new File(sourceFile);
                if (file.exists()) {
                    FileCopy.copyFile(sourceFile, targetFile, true);
                } else {
                    File file1 = new File(targetFile);
                    boolean delete = file1.delete();
                    System.out.println("原文件不存在，目标文件已删除："+targetFile);
                }
            }

        }*/
    }

    public static void deleteFile() throws Exception {
        String str = "C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\方太分支合并\\test";
        for (String s : FileRead.readFile(str)) {
            if (s.startsWith("原文件不存在，目标文件已删除：")) {
                System.out.println(s.replace("原文件不存在，目标文件已删除：",""));
            }
        }
    }

    public static void co() throws Exception {
        List<String> list = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\方太分支合并\\合并进程\\roll\\方太还原");

        List<String> initList = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\方太分支合并\\合并进程\\roll\\初始化提交");
        Set<String> collect = initList.stream().collect(Collectors.toSet());
        for (String s : list) {
            if (!collect.contains(s)) {
                System.out.println("s = " + s);
            }
        }

    }

    public static void cc() throws Exception {
        List<String> list = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\error.txt");
        Set<String> collect = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\error2.log").stream().collect(Collectors.toSet());
        for (String s : list) {
            String replace = s.replace("(V51)", "").replace("https://192.168.0.71/svn/", "C:/Datas/E9/a/");
            if (!collect.contains(replace)) {
                System.out.println(s);
            }
        }

    }

    public static void ccs() throws Exception {
        List<String> collect = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\error.txt");
        Set<String> list = FileRead.readFile("C:\\Users\\LENOVO\\AppData\\Roaming\\JetBrains\\IntelliJIdea2022.3\\scratches\\type-node\\error2.log").stream().collect(Collectors.toSet());
        for (String s : list) {
            String replace = s.replace("C:/Datas/E9/a/","https://192.168.0.71/svn/")+"(V51)";
            if (!collect.contains(replace)) {
                System.out.println(s);
            }
        }

    }
}
